home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4211 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: a pointer problem
  5. Date: 02 Feb 1996 18:41:20 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb2114120@qcd.lanl.gov>
  8. References: <4errk0$4c3@srvr1.engin.umich.edu> <31120AB7.1C44@cmt.lpr.mail.carel.fi>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: Ari Lukumies's message of Fri, 02 Feb 1996 14:59:35 +0200
  13.  
  14. In article <31120AB7.1C44@cmt.lpr.mail.carel.fi> Ari Lukumies
  15. <aril@cmt.lpr.mail.carel.fi> writes: 
  16. <snip>
  17.    You'll have to explicitly initialize the pointer, ANSI C (or any other standard) 
  18.    doesn't do it for you. However, most compilers tend to initialize variables (also 
  19.    pointers) declared outside of any function scope (or 'static' variables inside 
  20.    functions) to zero/NULL, but I wouldn't count on it.
  21.  
  22. ANSI requires conforming compilers to initialize objects of static
  23. duration (i.e. 'static' variables inside and any variables outside
  24. functions) and uninitialized parts of partially initialized structs
  25. and arrays to be initialized as if an = 0 was explicitly typed
  26. in. (This is the form of the rule I find easiest to remember: if you
  27. prefer you can think of this as saying that all pointers are
  28. initialized to NULL and all floats to 0.0F etc.)
  29.  
  30. Cheers
  31. Tanmoy
  32. --
  33. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  34. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  35. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  36. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  37. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  38. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  39.